<table class="table table-togglable table-hover">
    <thead>
    <tr>
        <th data-toggle="true">编号</th>
        <th data-hide="">名称</th>
        <th data-hide="phone,tablet">描述</th>
        <th data-hide="phone">状态</th>
        <th data-hide="phone">操作</th>
    </tr>
    </thead>
    <tbody>
    <?spa foreach(it.list as key => item): ?>
    <tr>
        <td>{{= item.id }}</td>
        <td>{{= item.name }}</td>
        <td>{{= item.desc }}</td>
        <td>{{= "正常" }}</td>
        <td>
            <button type="button" class="btn btn-default btn-xs" onclick='editGroup("{{= item.id }}")'><i class="icon-hat position-left"></i>编辑</button>
            <button type="button" class="btn btn-default btn-xs" onclick='deleteGroup("{{= item.id }}")'><i class="icon-cross2 position-left"></i>删除</button>
        </td>
    </tr>
    <?spa endForeach; ?>
    </tbody>
</table>

<script>
    var editGroup = function (id) {
        Alpaca.to("#/main/admin/groupEditView/" + id, {id: id});
    };

    var deleteGroup = function (id) {
        var param = {
            id: id,
            url: API['admin_group_delete'],
            callback: function () {
                Alpaca.to("#/main/admin/memberListView");
            }
        };
        Alpaca.to("#/main/index/delete/" + id, param);
    };

</script>
